package com.seata.demo.cloud.service;

import com.seata.demo.cloud.constant.SeataDict;
import com.seata.demo.cloud.dto.AccountDTO;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface AccountTccAction {

    @TwoPhaseBusinessAction(name = "reduce-balance",commitMethod = "commit",rollbackMethod = "cancel",useTCCFence = false)
    boolean reduceBalance(@BusinessActionContextParameter(paramName = SeataDict.TCC_PARAM)AccountDTO accountDTO);

    boolean commit(BusinessActionContext businessActionContext);

    boolean cancel(BusinessActionContext businessActionContext);
}
